//const express = require('express');
const mongoose = require('mongoose');
const config = require('./config');

const model = require('./models/models');
const viewVideos = model.viewVideos;
const viewMoments = model.viewMoments;
const viewComments = model.viewComments;
async function testViews(params) {
  const listvideos = viewVideos.findOne({})
    .then(data => {
      console.log(data);
      //process.exit()
    });
  const listmoments = viewMoments.findOne({})
    .then(data => {
      console.log(data);
      //process.exit()
    });
  const listcomments = viewComments.findOne({})
    .then(data => {
      console.log(data);
      //process.exit()
    });
    await listvideos;
    await listmoments;
    await listcomments;
    process.exit();
}
testViews();

mongoose.Promise = global.Promise;
mongoose.connect(config.atlasuri, {useNewUrlParser: true}); // 连接数据库

